@isTest

Private class IfulfillSyncWithQueueTest{


    static testMethod void test_Ifulfillsync()

    {       Profile p = [select id from profile where name='Standard User']; 
            User u = new User(alias = 'usrrerd', email='sfuser@salesforce.com', 
            emailencodingkey='UTF-8', lastname='sfuser', languagelocalekey='en_US', 
            localesidkey='en_US', profileid = p.Id, 
            timezonesidkey='America/Los_Angeles', username='sfusr@salesforce.com');
            insert u;
            set<id> setid = new set<id>();
            set<id> setid1 = new set<id>();
            set<id> setid2 = new set<id>();
            setid2.add(u.id);
            
       QueueSObject q = null;
        Profile p1 = [select id from profile where name='System Administrator'];                     
        User u1 = new User(alias = 'ipsyas', email='isadmin@accenture.com',emailencodingkey='UTF-8', lastname='TestUser',     languagelocalekey='en_US',localesidkey='en_US', profileid = p1.Id,timezonesidkey='Asia/Calcutta', username='ifulfilladmin@testorg.com');  
        Insert u1;         
        System.runAs(u1)
        {
   
               Group g = new Group(Type='Queue', Name='Queue007');
               insert g;
               system.debug('group idddddddddddd'+g.id);
               q = new QueueSObject(SobjectType='Fullfilment_Item__c', QueueId=g.Id);
               insert q;
        }  

            Assignment_Group_Name__c AG = new Assignment_Group_Name__c();
            AG.name = 'AG1';
            AG.Function__c = 'Advertiser Approval';
            AG.Type__c = 'Fulfillment';
            AG.Description__c = 'Description';
            AG.Round_Robin__c = true;
            insert AG;
    //IfulfillSyncWithQueue controller = new IfulfillSyncWithQueue();
            Assignment_Group_Queues__c AGQ = new Assignment_Group_Queues__c();
            AGQ.Name = 'Queue007';
            AGQ.Active__c = 'True';
            AGQ.Assignment_Group_Name__c = AG.id;
            AGQ.Valid_Queue__c = true;
            insert AGQ;
           
           
           Assignment_Groups__c AGR = new Assignment_Groups__c();
           AGR.Active__c = 'Active';
           AGR.Cycle_Team__c = 'IOG Tier 1'; 
           AGR.Group_Name__c = AG.id;
           AGR.User__c = u.id;
           
           Assignment_Groups__c AGR1 = new Assignment_Groups__c();
           AGR1.Active__c = 'Active';
           AGR1.Cycle_Team__c = 'IOG Tier 1'; 
           AGR1.Group_Name__c = AG.id;
           AGR1.User__c = u.id;

           insert AGR;
           insert AGR1;
           
           Delete AGR1;
           
           setid.add(AGR.id);
           setid1.add(AG.id);
           IfulfillSyncWithQueue.createQueueMember(setid);
           IfulfillSyncWithQueue.deleteQueueMember(setid2,setid1);     
           }
}